/**
 * useful for actions related to the item panel when we have a null entry we can set it to an empty string
 * and displays a significant message
 * @author zulianp@lu.unisi.ch & remo.lemma@lu.unisi.ch
 */

package ch.unisi.inf.projects.java.uom.gui.commands;

import java.awt.event.ActionEvent;


import ch.unisi.inf.projects.java.uom.gui.itemeditor.fieldselector.EntryGUI;

public final class EmptyStringCommand extends Command{

	
	private static final long serialVersionUID = -1L;
	private final EntryGUI entry;
	
	private final boolean invalidRef;
	
	public EmptyStringCommand (final EntryGUI entry, final boolean invalidRef)
	{
		this.entry = entry;
		this.invalidRef = invalidRef;
	}
	
	public void actionPerformed(final ActionEvent ev) {
		
		entry.setValue("");
	}

	
	public String toString()
	{
		if (invalidRef)
			return "Invalid Item - Choose another";
		else
			return "Choose your reference";
	}
}
